#include <bits/stdc++.h>
using namespace std;
const int N=1050;
const double _PI=3.1415926535;
struct Point{
    int x,y;
}p[N],s[N];
int t,n,r;
int top;
int cross(Point a,Point b,Point c){
    return (b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x);
}
double dis(Point a,Point b){
    return sqrt((double)(a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
bool cmp(Point a,Point b){
    int t=cross(p[0],a,b);
    if(t>0 || t==0 && dis(p[0],a)<dis(p[0],b)){
        return true;
    }else{
        return false;
    }
}
void init(int n){
    scanf("%d%d",&p[0].x,&p[0].y);
    Point p0=Point{p[0].x,p[0].y};
    int k=0;
    for(int i=1;i<n;i++){
        scanf("%d%d",&p[i].x,&p[i].y);
        if(p[i].y<p0.y || p[i].y==p0.y && p[i].x<p0.x){
            p0=p[i];
            k=i;
        }
    }
    p[k]=p[0];
    p[0]=p0;
    sort(p+1,p+n,cmp);
}
void graham(int n){
    top=1;
    s[0]=p[0];
    s[1]=p[1];
    for(int i=2;i<n;i++){
        while(top>0 && cross(s[top-1],s[top],p[i])<=0){
            top--;
        }
        s[++top]=p[i];
    }
}
int main(void){
    scanf("%d",&t);
    while(t--){
        scanf("%d%d",&n,&r);
        init(n);
        graham(n);
        // printf("*-----*\n");
        // for(int i=0;i<=top;i++){
        //     printf("%d %d\n",s[i].x,s[i].y);
        // }
        double ans=dis(s[0],s[top])+_PI*r*2;
        for(int i=1;i<=top;i++){
            ans+=dis(s[i],s[i-1]);
        }
        printf("%.0lf\n",ans);
        if(t){
            printf("\n");
        }
    }
    return 0;
}#include <bits/stdc++.h>
using namespace std;
const int N=1050;
const double _PI=3.1415926535;
struct Point{
    int x,y;
}p[N],s[N];
int t,n,r;
int top;
int cross(Point a,Point b,Point c){
    return (b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x);
}
double dis(Point a,Point b){
    return sqrt((double)(a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
bool cmp(Point a,Point b){
    int t=cross(p[0],a,b);
    if(t>0 || t==0 && dis(p[0],a)<dis(p[0],b)){
        return true;
    }else{
        return false;
    }
}
void init(int n){
    scanf("%d%d",&p[0].x,&p[0].y);
    Point p0=Point{p[0].x,p[0].y};
    int k=0;
    for(int i=1;i<n;i++){
        scanf("%d%d",&p[i].x,&p[i].y);
        if(p[i].y<p0.y || p[i].y==p0.y && p[i].x<p0.x){
            p0=p[i];
            k=i;
        }
    }
    p[k]=p[0];
    p[0]=p0;
    sort(p+1,p+n,cmp);
}
void graham(int n){
    top=1;
    s[0]=p[0];
    s[1]=p[1];
    for(int i=2;i<n;i++){
        while(top>0 && cross(s[top-1],s[top],p[i])<=0){
            top--;
        }
        s[++top]=p[i];
    }
}
int main(void){
    scanf("%d",&t);
    while(t--){
        scanf("%d%d",&n,&r);
        init(n);
        graham(n);
        // printf("*-----*\n");
        // for(int i=0;i<=top;i++){
        //     printf("%d %d\n",s[i].x,s[i].y);
        // }
        double ans=dis(s[0],s[top])+_PI*r*2;
        for(int i=1;i<=top;i++){
            ans+=dis(s[i],s[i-1]);
        }
        printf("%.0lf\n",ans);
        if(t){
            printf("\n");
        }
    }
    return 0;
}